﻿using System.Collections.Generic;
using Game.ui;
using GameFramework.events;
using UnityEngine;

namespace Game.data.PlayerData
{
    public class WarData
    {
        public List<JudianData> judians = new List<JudianData>();
        public List<GuanQiaData>  guanQia = new List<GuanQiaData>();

        public WarData()
        {
            MVPEventManager.Instance.onViewShowListener<WarView>(() =>
            {
                MVPEventManager.Instance.onViewModelPrepared(typeof(WarView),this);
            });
        }

        public void loadData()
        {
            //一部分存在本地运行时数据
            //一部分为配置的数据
            //先从配置表加载所有数据，在合并运行时数据
            
            //先moke数据
            for (int i = 1; i <= 4; i++)
            {
                JudianData judianData = new JudianData();
                judianData.id = i;
                judianData.name = "据点" + i;
                if (i < 3)
                {
                    judianData.locked = false;
                }


                judians.Add(judianData);
            }
            
            foreach (JudianData judianData in judians)
            {
                if (judianData.locked)
                {
                    continue;
                }

                for (int i = 1; i <= 10; i++)
                {
                    GuanQiaData guanQiaData = new GuanQiaData();
                    guanQiaData.id = i;
                    guanQiaData.name = "据点" + judianData.id + "-关卡" + i;
                    guanQiaData.judianId = judianData.id;
                    guanQia.Add(guanQiaData);
                }
            }


        }
    }
}